#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "life"
# Date: 2016/12/30

# class Foo(object):
#     def __init__(self):
#         self.name = 'alex'
#
#
# # 不允许使用 obj.name
# obj = Foo()
#
# print(obj.__dict__['name'])
# print(getattr(obj, 'name'))

from wsgiref.simple_server import make_server
#
# class Handler(object):
#     def index(self):
#         return 'index'
#     def news(self):
#         return 'news'
#
# def RunServer(environ,start_response):
#     start_response('200 ok',[('Content-Type','text/html')])
#     url = environ['PATH_INFO']
#     temp = url.split('/')[1]
#     obj = Handler()
#     is_exist = hasattr(obj,temp)
#     if is_exist:
#         func = getattr(obj,temp)
#         ret = func()
#         return ret
#     else:
#         return '404 not found'
# if __name__ == '__main__':
#     httpd = make_server('',8001,RunServer)
#     print('server HTTP on port 8000...')
#     httpd.serve_forever()

class DbHelper(object):
    def __init__(self):
        self.hostname = '1.1.1.1'
        self.port = 3306
        self.password = 'pwd'
        self.username = 'root'
    def fetch(self):